package Window;

import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.io.FileReader;
import java.net.URL;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;

public class ShowPictureWindow extends JFrame {

	private JPanel contentPane;
	private static String[] args=null;

	/**
	 * Launch the application.
	 */
	public static void main(final String[] args) {
		ShowPictureWindow.args=args;
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					ShowPictureWindow frame = new ShowPictureWindow();
					frame.setVisible(true);
					if(args.length!=0){
						frame.setTitle(args[1]);
					}
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public ShowPictureWindow() {
		setBounds(100, 100, 950, 550);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		if(args.length==0){
			setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		}else{
			setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
		}
		
		JLabel lblNewLabel = new JLabel("");
		lblNewLabel.setBounds(0, 0, 960, 540);
		contentPane.add(lblNewLabel);
		try {
			if(args.length!=0){
				URL icon_Url=ShowPictureWindow.class.getResource(args[0]+".jpg");
				System.out.println(args[0]+".jpg");
				ImageIcon ii=new ImageIcon(icon_Url);
				lblNewLabel.setIcon(ii);
			}
		} catch (Exception e) {
			lblNewLabel.setText(args[1]);
		}
	}

}
